package cn.xuchunh.exam;

import java.util.Scanner;

/**
 * 80%
 * Created by XuChunH on 2016/9/12.
 */
public class DarkString {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int sum = (int) Math.pow(3, n);
        if(n < 3) {
            System.out.println(sum);
            return;
        }
        int[] temp1 = new int[30];
        int[] temp2 = new int[30];
        temp1[1] = 3;
        temp2[1] = 6;
        for (int i = 2; i < n; i++) {
            temp1[i] = temp1[i - 1] + temp2[i - 1];
            temp2[i] = temp2[i - 1] + temp1[i - 1] * 2;
        }
        System.out.println(temp1[n - 1] + temp2[n - 1]);
    }
}
